import request from '@/utils/request'

/**
 * 获取基础题库列表
 */

export const getQuestionsListAPI = (params) => {
  return request({
    method: 'get',
    url: '/questions',
    params
  })
}

/**
 * 基础图库删除
 */

export const delQuestionAPI = (id) => {
  return request({
    method: 'delete',
    url: `/questions/${id}`
  })
}

/**
 * 基础题库添加
 */
export const addQUestionAPI = (data) => {
  return request({
    method: 'post',
    url: '/questions',
    data
  })
}

/**
 * 获取基础题库详情
 */

export const getQuesDetailAPI = (id) => {
  return request({
    method: 'get',
    url: `/questions/${id}`
  })
}

/**
 * 修改基础题库
 */
export const updateQuestionAPI = (id, data) => {
  return request({
    method: 'put',
    url: `/questions/${id}`,
    data
  })
}

/**
 * 加入或移除精选
 */
export const addOrRemoveChoiceAPI = (id, choiceState) => {
  return request({
    method: 'patch',
    url: `/questions/choice/${id}/${choiceState}`
  })
}
